/***************************************************************************************************** 
* File name:               cube.h 
* Create time:             2012/05/18
* Module:                  View 
* Author:                  zengqh 
* Company                  Qmap, All right reserved
* --------------------------------------------------------------------------------------------------- 
* Memo: 
* 
*****************************************************************************************************/  
#ifndef cube_h__
#define cube_h__
/***************************************************************************************************** 
*                                  Macro and Struct definition 
*****************************************************************************************************/  

/***************************************************************************************************** 
*                                  Global variables 
*****************************************************************************************************/
const static int num_cube_vertex = 36;
/***************************************************************************************************** 
*                                  Global function declare 
*****************************************************************************************************/  
/* in directx, we like put vertex, normal, texcoord together */
struct cube_vertex	
{
	float x;
	float y;
	float z;
	float nx;
	float ny;
	float nz;
	float u;
	float v;
};

#define CUBE_VERTEX_SIZE					(sizeof(cube_vertex))

#define CUBE_FRONT_BYTE_VERTEX_OFFSET		(0)
#define CUBE_BACK_BYTE_VERTEX_OFFSET		(6 * CUBE_VERTEX_SIZE)
#define CUBE_LEFT_BYTE_VERTEX_OFFSET		(12 * CUBE_VERTEX_SIZE)
#define CUBE_RIGHT_BYTE_VERTEX_OFFSET		(18 * CUBE_VERTEX_SIZE)
#define CUBE_TOP_BYTE_VERTEX_OFFSET			(24 * CUBE_VERTEX_SIZE)
#define CUBE_BOTTOM_BYTE_VERTEX_OFFSET		(30 * CUBE_VERTEX_SIZE)

#define CUBE_FRONT_BYTE_INDEX_OFFSET		(0)
#define CUBE_BACK_BYTE_INDEX_OFFSET			(6 * sizeof(u16))
#define CUBE_LEFT_BYTE_INDEX_OFFSET			(12 * sizeof(u16))
#define CUBE_RIGHT_BYTE_INDEX_OFFSET		(18 * sizeof(u16))
#define CUBE_TOP_BYTE_INDEX_OFFSET			(24 * sizeof(u16))
#define CUBE_BOTTOM_BYTE_INDEX_OFFSET		(30 * sizeof(u16))
/***************************************************************************************************** 
*                                  Global function definition 
*****************************************************************************************************/
/* this is for dx, you should set cull front in opengl */
static float cube_vertex_content[36 * 8] =
{
	/* front 376 and 362 */
	/* 3 */
	-1.0f, -1.0f, 1.0f,
	0.0f,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
	0.0f, 0.0f,

	/* 0 */
	-1.0f, -1.0f, -1.0f,
	0.0f, -1.0f, 0.0f,
	1.0f, 1.0f,

	/* 3 */
	-1.0f, -1.0f, 1.0f,
	0.0f, -1.0f, 0.0f,
	1.0f, 0.0f,
};

static u16 cube_index_content[36] = 
{
	0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
	22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35
};
/***************************************************************************************************** 
*                                  Class declare 
******************************************************************************************************/

/***************************************************************************************************** 
*                                  Class definition 
*****************************************************************************************************/
#endif	/* cube_h__ */
/***********************************End of File*******************************************************/  